/**
 * Created with CLion.
 * Description: 
 * User: loong
 * Date: 2023/12/19
 * Time: 21:06
 */

#include "Doc.h"
#include "NodeImpl.h"

namespace Config {

    Doc::Doc(std::string _key, std::string _value)
        : Node(_key,_value)
    {
    }

    NodeList Doc::Query(const std::string & _path)
    {
        xpath_query          query(_path.c_str());

        auto xml_node = NodeImpl::ToXmlNode(shared_from_this());
        auto query_ret = xml_node.select_nodes(query);

        NodeList ret;
        for(const auto &item : query_ret)
            ret.emplace_back(NodeImpl::ToNode(item.node()));

        return ret;
    }

}// namespace Config